import { h, init } from 'snabbdom'
// 1. import modules
import style from 'snabbdom/modules/style'
import eventlisteners from 'snabbdom/modules/eventlisteners'

let patch = init([
    style,
    eventlisteners
])

let vnode = h('div', {
    style: {
        backgroundColor: 'red'
    },
    on: {
        click: eventHandler
    }
}, [
    h('h1', 'Hello Snabbdom'),
    h('p', '这是一个p标签')
])

function eventHandler () {
    console.log('click me')
}

let app = document.querySelector('#app')

patch(app, vnode)